package com.app.implementation.dao;

import com.app.model.Personnel;
import com.app.interfaces.AuthentificationDAO;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 *
 * @author Krachleur
 */
public class AuthentificationDaoImpl extends HibernateDaoSupport implements AuthentificationDAO {

    public Personnel findByLoginAndPassword(String login, String pass) {
        try{
            Personnel pers = (Personnel)getHibernateTemplate().find("from Personnel pers where pers.persLogin ='"+ login +
                    "' and pers.persPassword ='" + pass +"'").get(0);
            return pers;
        }catch(Exception e){
            e.printStackTrace();
            return null;
        }
    }

}